﻿@model IEnumerable<Fcom.VNInsurance.Web.Models.ProductLang>
@{
    var CatProduct = (Fcom.VNInsurance.Web.Models.ProductCat) ViewBag.CatProduct;
    ViewBag.Title = "Danh mục "+CatProduct.CatName;
    Layout = "~/Views/Shared/_CpanelLayout.cshtml";
}
<link rel="stylesheet" media="screen" type="text/css" href="@Url.Content("~/Content/ColorPick/css/colorpicker.css")" />
<script type="text/javascript" src="@Url.Content("~/Content/ColorPick/js/colorpicker.js")"></script>
<script>
    $(document).ready(function () {
        $('#CatColor').ColorPicker({
            color: "@CatProduct.CatColor",
            onChange: function (hsb, hex, rgb) {
                $('#CatColor').val(hex);
                $('#CatColor').css("background", "#" + hex);
            }
        });
        $('#CatColor').keypress(function () {
            $('#CatColor').css("background", "#" + $(this).val());
        });
        $("#btnchangecolor").click(function () {
            var oldcolor = $("#oldcolor").html();
            var newcolor = $("#CatColor").val();
            if (oldcolor != newcolor)
            {
                if (confirm("Bạn có muốn thay đổi màu này hay không?"))
                {
                    //ajChangeCatColor(int CatID, string color)
                    $.ajax({
                        url:"@Url.Action("ajChangeCatColor","Product")",
                        type: "post",
                        data: { CatID: $("#CatPID").val(), color: $("#CatColor").val() },
                        datatype:"json",
                        success:function(){
                            $("#msgcolor").text("Thay đổi màu thành công");
                            $("#msgcolor").fadeIn(100).fadeOut(3000);
                            $("#oldcolor").html(newcolor);
                            $('#CatColor').css("background", "#" + newcolor);
                        }
                    });
                 
                }
            }
            return false;
        });

    });
   
</script>
<div class="container" style="padding:10px;">
      <fieldset>
                 <legend >Quản lý bảo hiểm <span style="color:#000">@CatProduct.CatName</span> </legend>
          @Html.Hidden("CatPID",CatProduct.ID)
     </fieldset>
       Màu nền# <input type="text" id="CatColor"   value="@CatProduct.CatColor" maxlength="6" style="width:60px;color:#fff;background:#@CatProduct.CatColor" /><span id="oldcolor" style="display:none">@CatProduct.CatColor</span> <input type="button" id="btnchangecolor" value="Đổi màu"  /><span id="msgcolor" style="color:#0026ff;font-weight:bold"></span><br /><br />
        <div class="row">
            @foreach(var p in Model)
            {
              <div class="col-sm-4 col-md-4">
                <div class="thumbnail" style="min-height:250px;margin-bottom:10px;">
                  <div class="caption">
                    <h3>@p.DisplayName</h3>
                   <p>
                       <a class="btn" href="@Url.Action("MNProductDetail", "Product", new { ProductID=p.ProductID})"><img src="@Url.Content("~/Content/images/messageInformation.gif")" /></a> 
                       <a class="btn"  href="@Url.Action("MNFaq", "Product", new { ProductID=p.ProductID})"><img src="@Url.Content("~/Content/images/icon_faq.png")" /></a> 
                         <a class="btn"  href="@Url.Action("MNFaq", "Product", new { ProductID=p.ProductID})"><img src="@Url.Content("~/Content/images/B-icon.png")" /></a> 
                       <a class="btn"  href="@Url.Action("ManageProductByID", "CompanyProduct", new { ID=p.ProductID})"><img src="@Url.Content("~/Content/images/company.png")" /></a>


                       <a class="btn"  href="@Url.Action("MNPackage", "Product", new { ID=p.ProductID})">QL Gói sản phẩm</a>
                       
                   </p>                    
                      <p>@p.SmallIntro</p>
                  </div>
                </div>
              </div>
            }
     </div>
   
</div>
